package com.csd.action.manager;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.csd.helper.ActionResult;
import com.csd.helper.ProjectState;
import com.csd.service.IScoreService;
/**
 * 管理员添加成绩，包括答辩和最终成绩
 * @author sanmu
 *	<br>创建于2009-12-28
 */
public class ScoreAddOfManagerAction {

	private Integer projectID;
	
	private Integer answerScore;
	
	private Integer phaseScore;
	
	private String stage ;
	
	public String getStage() {
		return stage;
	}

	public void setStage(String stage) {
		this.stage = stage;
	}

	private IScoreService scoreService;

	public Integer getProjectID() {
		return projectID;
	}

	public void setProjectID(Integer projectID) {
		this.projectID = projectID;
	}

	public Integer getAnswerScore() {
		return answerScore;
	}

	public void setAnswerScore(Integer answerScore) {
		this.answerScore = answerScore;
	}

	public Integer getPhaseScore() {
		return phaseScore;
	}

	public void setPhaseScore(Integer phaseScore) {
		this.phaseScore = phaseScore;
	}

	public IScoreService getScoreService() {
		return scoreService;
	}

	public void setScoreService(IScoreService scoreService) {
		this.scoreService = scoreService;
	}
	
	public String execute()throws Exception{
		String text = ActionResult.fail;
		String state="";
		if(stage.equals("1"))
			state = ProjectState.beforeStage;
		else if(stage.equals("2"))
			state = ProjectState.middleStage;
		else if(stage.equals("3"))
			state = ProjectState.afterStage;
		else
			return text;
		boolean bl = false;
		//管理员添加成绩
		bl = scoreService.scoreAddOfManager(projectID, answerScore, phaseScore, state);
		if (bl) {
			text = ActionResult.success;
		}
		return text;
	}
}
